package com.example.administrator.mytest;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;


public class RecAdapter extends RecyclerView.Adapter<RecAdapter.MyViewHolder> {
    private Context context;
    private List<Data.DataBean> Entities;
    private  LayoutInflater mLayoutInflater;

    public RecAdapter(Context context, List<Data.DataBean> Entities) {
        this.mLayoutInflater = LayoutInflater.from(context);
        this.context = context;
        this.Entities = Entities;
    }
  
    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        MyViewHolder holder=new MyViewHolder(mLayoutInflater.inflate(R.layout.item_text,parent,false));
        return holder;
    }
    
    @Override
    public void onBindViewHolder(MyViewHolder holder, final int position) {
        final Data.DataBean data=Entities.get(position);
        holder.tv01.setText("订单号"+data.getOrder_sn());
    }
    
    @Override
    public int getItemCount() {
        return Entities==null?0:Entities.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder  {
        private final TextView tv01;
        public MyViewHolder(View view) {
            super(view);
            tv01 = (TextView) view.findViewById(R.id.item_tv1);
        }
        
    }

    
}
